#ifndef _GL_MESH_H_
#define _GL_MESH_H_

#include "../glew/glew.h"

#include "../cuCommon/cuTypes.h"
#include "../cuCommon/cuMath.h"
#include "../cuCommon/cuBuffer.h"

#include "../rtCommon/C_BaseMaterial.h"

#include "../glCommon/glProgram.h"

#include "XobjIO.h"

class CglMesh
{

public:
  sf4Buffer  pos; // POSition
  sf4Buffer  clr; // CoLoR
  sf4Buffer  nml; // NorMaL
  sf4Buffer  tnt; // TangeNT
  sf4Buffer  bnt; // BitangeNT
  sf2Buffer  uv;  // uv texture coordinates

  si_Buffer  posIdx;
  si4Buffer  clrIdx;
  si4Buffer  uvIdx;

  matrix4x4 matrixWS;

  C_BaseMaterial material;

  CglProgram * program;

	CglMesh();
	CglMesh(const CXobjIO & xobjIO);
	virtual ~CglMesh();

	void Create(const CXobjIO & xobjIO);

	void Update(uint8 uFlags);
	void Release();

	void Swap();

	void Null();
};

#endif